package com.walleipt.demo.extension.beanFactoryPostProcessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;

import com.walleipt.demo.extension.BeanDefinitionRegistryPostProcessor.BeanDemo;

public class MyBeanFactoryPostProcessor implements BeanDefinitionRegistryPostProcessor {

	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		
		System.err.println( "execute...............postProcessBeanFactory............." );
	}

	public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
		
		System.err.println( "execute...............postProcessBeanDefinitionRegistry............." );
		BeanDefinitionBuilder rootBeanDefinition = BeanDefinitionBuilder.rootBeanDefinition(BeanDemo.class);
		registry.registerBeanDefinition("aaaa", rootBeanDefinition.getBeanDefinition());
	}

}
